package com.fjp.heartguard.viewmodel

import androidx.lifecycle.MutableLiveData
import com.fjp.heartguard.R
import com.fjp.heartguard.app.data.bean.UserInfo
import com.fjp.heartguard.app.network.HttpRequestCoroutine
import me.hgj.jetpackmvvm.base.appContext
import me.hgj.jetpackmvvm.base.viewmodel.BaseViewModel
import me.hgj.jetpackmvvm.ext.request
import me.hgj.jetpackmvvm.state.ResultState

/**
 *Author:Mr'x
 *Time:2025/1/1
 *Description:
 */
class LoginViewModel : BaseViewModel() {
    val enableLogin = MutableLiveData(false)
    val mobile = MutableLiveData("")
    val password = MutableLiveData("")
    var loginResult = MutableLiveData<ResultState<UserInfo>>()

    fun loginReq() {
        request({
            HttpRequestCoroutine.login(mobile.value!!, password.value!!)
        }, loginResult, true, appContext.getString(R.string.loading_login))

    }

}